package com.huangdebiao.oa.service.impl;

import com.huangdebiao.oa.dao.UserDao;
import com.huangdebiao.oa.dto.UserRoleDto;
import com.huangdebiao.oa.entity.RoleEntity;
import com.huangdebiao.oa.service.UserService;
import com.huangdebiao.oa.utils.DaoFactory;

import java.util.List;

public class UserServiceImpl implements UserService {

    private UserDao userDao = null;

    {

        DaoFactory<UserDao> userDaoFactory = new DaoFactory<>();
        userDao = userDaoFactory.getDao(UserDao.class);

    }

    /**
     * 查询手机号码是否存在
     * @param phoneNumber
     * @return
     */
    @Override
    public Integer checkPhoneNumber(String phoneNumber) {
        return userDao.checkPhoneNumber(phoneNumber);
    }

    /**
     * 查询所有用户的所有角色
     * @return
     */
    @Override
    public List<UserRoleDto> findAllRolesOfAllUser() {
        return userDao.findAllRolesOfAllUser();
    }
}
